<g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
</g:if>
<g:hasErrors bean="${customerInstance}">
    <div class="errors">
        <g:renderErrors bean="${customerInstance}" as="list"/>
    </div>
</g:hasErrors>
<g:form action="save" method="post">
    <calendar:resources lang="en" theme="aqua"/>
    <div class="dialog">
        <table>
            <tbody>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="name">${message(code: 'customer.table.name')}<ps:mandatory/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'name', 'errors')}">
                    <input type="text" id="name" name="name" value="${fieldValue(bean: customerInstance, field: 'name')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="dob">${message(code: 'customer.table.dob')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'dob', 'errors')}">
                    <calendar:datePicker name="dob" value="${customerInstance?.dob}" dateFormat="%Y/%m/%d" years="1900, 2049"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="handPhone">${message(code: 'customer.table.phone')}<ps:mandatory/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'handPhone', 'errors')}">
                    <input type="text" id="handPhone" name="handPhone" value="${fieldValue(bean: customerInstance, field: 'handPhone')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="cardNumber">${message(code: 'customer.table.cardNumber')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'cardNumber', 'errors')}">
                    <input type="text" id="cardNumber" name="cardNumber" value="${fieldValue(bean: customerInstance, field: 'cardNumber')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="street">${message(code: 'customer.table.street')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'street', 'errors')}">
                    <input type="text" id="street" name="street" value="${fieldValue(bean: customerInstance, field: 'street')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="postalCode">${message(code: 'customer.table.postal')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'postalCode', 'errors')}">
                    <input type="text" id="postalCode" name="postalCode" value="${fieldValue(bean: customerInstance, field: 'postalCode')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="homePhone">${message(code: 'customer.table.home.phone')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'homePhone', 'errors')}">
                    <input type="text" id="homePhone" name="homePhone" value="${fieldValue(bean: customerInstance, field: 'homePhone')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="membership">${message(code: 'customer.table.membership')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'membership', 'errors')}">
                    <g:select optionKey="id" from="${Membership.list()}" name="membership.id" value="${customerInstance?.membership?.id}"></g:select>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="point">${message(code: 'customer.table.point')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'point', 'errors')}">
                    <input type="text" id="point" name="point" value="${fieldValue(bean: customerInstance, field: 'point')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="remark">${message(code: 'customer.table.remark')}:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: customerInstance, field: 'remark', 'errors')}">
                    <input type="text" id="remark" name="remark" value="${fieldValue(bean: customerInstance, field: 'remark')}"/>
                </td>
            </tr>

            </tbody>
        </table>
    </div>
    <div class="buttons">
        <span class="button"><input class="save" type="submit" value="${message(code:'common.button.save')}"/></span>
    </div>
</g:form>